# -*- coding: UTF-8 -*-
# __author__ = '10459'

#sqlalchemy
#flask_sqlalchemy
#wtforms
#flask_wtforms
from sqlalchemy import Column,Integer,String
from app.models.base import Base


class Book(Base):
    id = Column(Integer,primary_key=True,autoincrement=True)
    title = Column(String(50),nullable=False)   #nullable不允许为空
    author = Column(String(30),default="无名书籍")
    binding = Column(String(20))  #装帧版本：平装精装等
    publisher = Column(String(50))
    price = Column(String(20))
    pages = Column(Integer)
    pubdate = Column(String(20))
    isbn = Column(String(15), nullable=False, unique = True)
    summary = Column(String(1000))  #简介
    image = Column(String(50))
    #MVC  M  存储+业务模型+业务方法而不仅仅是储存还有业务方法操作model层，所以要通过代码创建表格，而不是手动创建
    #ORM  对象关系映射 操作模型间接操作数据库
    #code first  创建表
    def sample(self):
        pass
Book()